package bb.lanxing.lib.devices.sprint.entity;

import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.core.util.ObjectsCompat;

public class DisplayProfile implements Parcelable {
    public static final Parcelable.Creator<DisplayProfile> CREATOR = new Parcelable.Creator<DisplayProfile>() {
        @Override
        public DisplayProfile createFromParcel(Parcel parcel) {
            return new DisplayProfile(parcel);
        }

        @Override
        public DisplayProfile[] newArray(int i) {
            return new DisplayProfile[i];
        }
    };
    private int count;
    private String name;
    private boolean open;
    private Bundle sockets;

    @Override
    public int describeContents() {
        return 0;
    }

    protected DisplayProfile(Parcel parcel) {
        this.name = parcel.readString();
        this.open = parcel.readByte() != 0;
        this.count = parcel.readInt();
        this.sockets = parcel.readBundle(getClass().getClassLoader());
    }

    @Override
    public void writeToParcel(Parcel parcel, int i) {
        parcel.writeString(this.name);
        parcel.writeByte(this.open ? (byte) 1 : (byte) 0);
        parcel.writeInt(this.count);
        parcel.writeBundle(this.sockets);
    }

    public String getName() {
        return this.name;
    }

    public boolean isOpen() {
        return this.open;
    }

    public int getCount() {
        return this.count;
    }

    public void setName(String str) {
        this.name = str;
    }

    public void setOpen(boolean z) {
        this.open = z;
    }

    public void setCount(int i) {
        this.count = i;
    }

    public int getItem(String str) {
        Bundle bundle = this.sockets;
        if (bundle == null || !bundle.containsKey(str)) {
            return -1;
        }
        return this.sockets.getInt(str);
    }

    public void setItem(String str, int i) {
        if (this.sockets == null) {
            this.sockets = new Bundle();
        }
        this.sockets.putInt(str, i);
    }

    public DisplayProfile(DisplayProfile displayProfile) {
        this.name = displayProfile.name;
        this.open = displayProfile.open;
        this.sockets = displayProfile.sockets != null ? new Bundle(displayProfile.sockets) : null;
        this.count = displayProfile.count;
    }

    public DisplayProfile() {
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || getClass() != obj.getClass()) {
            return false;
        }
        DisplayProfile displayProfile = (DisplayProfile) obj;
        if (this.open != displayProfile.open || this.count != displayProfile.count) {
            return false;
        }
        String str = this.name;
        if (str == null ? displayProfile.name != null : !str.equals(displayProfile.name)) {
            return false;
        }
        return equalBundles(this.sockets, displayProfile.sockets);
    }

    public int hashCode() {
        String str = this.name;
        int i = 0;
        int hashCode = (((((str != null ? str.hashCode() : 0) * 31) + (this.open ? 1 : 0)) * 31) + this.count) * 31;
        Bundle bundle = this.sockets;
        if (bundle != null) {
            i = bundle.hashCode();
        }
        return hashCode + i;
    }

    public boolean equalBundles(Bundle bundle, Bundle bundle2) {
        boolean z;
        if (bundle != null) {
            z = bundle.equals(bundle2);
        } else {
            z = bundle2 == null;
        }
        if (z || bundle == null || bundle2 == null) {
            return z;
        }
        if (bundle.size() != bundle2.size() || !bundle.keySet().containsAll(bundle2.keySet())) {
            return false;
        }
        for (String str : bundle.keySet()) {
            if (!ObjectsCompat.equals(bundle.get(str), bundle2.get(str))) {
                return false;
            }
        }
        return true;
    }
}
